# app.py

from flask import Flask
from flask_cors import CORS

from config import Config
from models import db
from api.colleges import colleges_bp
from api.teachers import teachers_bp
from api.courses import courses_bp
from api.teaching_records import teaching_records_bp
app = Flask(__name__)
CORS(app)

# 加载配置
app.config.from_object(Config)

# 初始化数据库
db.init_app(app)

# 注册蓝图
app.register_blueprint(colleges_bp)
app.register_blueprint(teachers_bp)
app.register_blueprint(courses_bp)
app.register_blueprint(teaching_records_bp)
# 创建所有表
with app.app_context():
    db.create_all()

if __name__ == '__main__':
    app.run(debug=True)
